import sys

INT_MAX = 2147483647
INT_MIN = -2147483648


class Solution:
    def reverse(self, x):
        """
        :type x: int
        :rtype: int
        """
        if x < 0:
            flag = -1
        else:
            flag = 1

        strList = list(str(x * flag))
        strList.reverse()
        res = flag * int(''.join(strList))

        if res > INT_MAX or res < INT_MIN:
            return 0
        else:
            return res


s = Solution()
print(s.reverse(129))
print(s.reverse(-129))
print(''.maketrans('intabs', 'outtab'))
